﻿CREATE PROCEDURE [dbo].[proc_L_Reimbursement_Assets_Create]
	(
		@CategoryId int,
		@NameId int,
		@Description nvarchar(500),
		@CompanyId int,
		@DepartmentId int,
		@UserName nvarchar(50),
		@EName nvarchar(50),
		@StateId int,
		@Prices numeric(18,2),
		@DJUserName nvarchar(50),
		@DJDate datetime,
		@GGXH nvarchar(50),
		@GZDate datetime,
		@Number int,
		@zcbh VARCHAR(50),
		@memo NVARCHAR(2000),
		@userid VARCHAR(30),
		@username_1 NVARCHAR(50),
		@itemid int,
		@typeid int
	)
AS
begin
	--资产编号
	declare @Anumber varchar(10),@tempNumber varchar(10)				
	declare @i int
	Set @i=0
	select @typeid=[typeid] from [Assets_Names] where id=@NameId
	While @i<@Number
		begin
			--生成资产编号
			
			set @Anumber = ''
					
			Insert Into L_Reimbursement_Assets
			(
				CategoryId,
				NameId,
				Description,
				CompanyId,
				DepartmentId,
				UserName,
				EName,
				StateId,
				Prices,
				DJUserName,
				DJDate,
				GGXH,
				GZDate,
				ANumber,
				itemid,
				typeid
			)
			Values
			(
				@CategoryId,
				@NameId,
				@Description,
				@CompanyId,
				@DepartmentId,
				@UserName,
				@EName,
				@StateId,
				@Prices,
				@DJUserName,
				@DJDate,
				@GGXH,
				@GZDate,
				@Anumber,
				@itemid,
				@typeid
			)
			Set @i=@i+1
			
					
			
		END
		
end
	RETURN
